class Solution(object):
    def findRadius(self, houses, heaters):
        """
        :type houses: List[int]
        :type heaters: List[int]
        :rtype: int
        """
        houses = list(set(houses))
        heaters = list(set(heaters))
        houses.sort()
        heaters.sort()
        heaters.append(float('inf'))
        now_max = 0
        n1 = len(houses)
        left_index = 0
        right_index = 0
        while left_index < n1:
            if houses[left_index] <= heaters[right_index]:
                now_max = max(now_max, heaters[right_index] - houses[left_index])
                left_index += 1
            else:
                if houses[left_index] <= (heaters[right_index] + heaters[right_index + 1]) / 2:
                    now_max = max(now_max, houses[left_index] - heaters[right_index])
                    left_index += 1
                else:
                    right_index += 1
        return now_max


data = Solution()
houses = [1, 2, 3]
heaters = [2]
print(data.findRadius(houses, heaters))
